﻿using HomagChina.CCHCS.DataTypeModel;
using HomagChina.CCHCS.ViewModels;
using HomagGroup.Base.UI;
using HomagGroup.Base.UI.Themes.Resources;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using static HomagChina.CCHCS.ProcessResourceInternal;
using static HomagChina.CCHCS.Utility;
using MenuItem = HomagGroup.Base.UI.Controls.MenuItem;

namespace HomagChina.CCHCS.Router
{
    public class TransHistoryRoute
    {
        public RouterItemDataModel TransHistoryRouteModel { get; set; }

        public TransHistoryRoute()
        {
            var model = new TransHistoryViewModel();
            TransHistoryRouteModel = new RouterItemDataModel()
            {
                ID = "TransHistory",
                viewLabel = GetLocalText("TransHistory"),
                viewName = "TransHistory",
                viewModelName = "TransHistoryViewModel",
                ViewModel = model,
                keepalive = false,
                userControl = GetUserControlInstance("TransHistory"),
                Image = null,
                functionKeyBarItems = new ObservableCollection<FunctionKeyBarItemDataModel>
                {
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocalText("Exit"),
                    //    Position = 12,
                    //    Icon = GetIconBrush(Icon.Close, ImageDecoration.Circle),
                    //    Command = new RelayCommand(() => { Application.Current.Shutdown(); })
                    //},
                    new FunctionKeyBarItemDataModel() {
                        Header = GetLocalText("Extras"),
                        Position = 10,
                        Icon = GetIconBrush(Icon.More, overlayIcon: OverlayIcon.None),
                        MenuItems = new List<MenuItem>
                        {
                            new MenuItem { Header =  GetLocalText("Settings"), Icon =GetResourceBrush("items") },
                            new MenuItem { Header =  GetLocalText("Create_service_file"), Icon= GetResourceBrush("TableSettingsImage")  }
                        }
                    },
                    new FunctionKeyBarItemDataModel() {
                        Header = GetLocalText("Filter_off") ,
                        Position = 9,
                        Icon = GetIconBrush(Icon.ViewGrid,overlayIcon:OverlayIcon.Check),
                        Command=new RelayCommand(model.HandleIsShowFilter)
                    },
                    new FunctionKeyBarItemDataModel(){
                        Header =  GetLocalText("Advanced"),Position = 8,
                        Icon = GetResourceBrush("Advanced"),
                        MenuItems = new List<MenuItem>
                        {
                            new MenuItem {
                                Header =  GetLocalText("Freeze"),IsCheckable = true,
                                Command=new RelayCommand(model.HandleIsFreeze)
                            },
                            new MenuItem {
                                Header =  GetLocalText("TransHistory") ,IsCheckable = true,
                                Command=new RelayCommand(model.HandleIsHistory)
                            }
                        }
                    },
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocaText("Error_message"),
                    //    Position = 11,
                    //    Icon = GetResourceBrush("ErrorMessages"),
                    //    Command = new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("ErrorMessages"); })
                    //},
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocaText("Info"), Position = 1, Icon = GetIconBrush(Icon.Information, imageDecoration: ImageDecoration.Circle),
                    //    Command = new RelayCommand(() => { Handle_Common.OpenInformationCommand(Handle_Search.GetSystemInfoMation()); })
                    //}
                }
            };
            TransHistoryRouteModel.userControl.DataContext = model;
        }
    }
}